<template>
	<el-row>
		<el-col :span="24">
			<el-table class="table" :data="tableData" style="width: 100%;text-align: center">
				<el-table-column prop="stuName" label="学员姓名"></el-table-column>
				<el-table-column prop="idCard" label="证件号码"></el-table-column>
				<el-table-column prop="subject" label="退费科目">
					<template slot-scope="scope">
						{{['','','科目二','科目三'][scope.row.subject]}}
					</template>
				</el-table-column>
				<el-table-column prop="lessionType" label="学时类型">
					<template slot-scope="scope">
						{{['','普通学时','模拟学时','','加时学时'][scope.row.lessionType]}}
					</template>
				</el-table-column>
				<el-table-column prop="lessionTime" label="退费学时数"></el-table-column>
				<el-table-column prop="amount" label="退费金额(元)"></el-table-column>
				<el-table-column prop="operator" label="经办人" min-width="140"></el-table-column>
				<el-table-column prop="remark" label="备注" min-width="140"></el-table-column>
				<el-table-column prop="createDate" label="退款时间"></el-table-column>
				<el-table-column prop="refStatus" label="状态">
					<template slot-scope="scope">
						{{['','处理中','已处理','退费失败'][scope.row.refStatus]}}
					</template>
				</el-table-column>
			</el-table>
		</el-col>
		<el-col :span="24" class="my-pagination">
			<el-pagination background layout="total, prev, pager, next" :total="total" :page-size="pageSize" :current-page="currentPage" @current-change="handleCurrentChange">
			</el-pagination>
		</el-col>
	</el-row>
</template>

<script>
	export default {
		name: "bmf-table",
		mounted() {
			this.loadData();
		},
		data() {
			return {
				total: 1, //分页数据总条数
				currentPage: 1,
				pageSize: 8,
				tableData: []
			};
		},
		methods: {
			loadData() {
				this.$http.post('iem/refundRecorfs', {
					currentPage: this.currentPage,
					pageSize: this.pageSize,
					_method: "PATCH"
				}, d => {
					if(d.status == '1') {
						this.tableData = d.rows;
						this.total = d.total;
					} else {
						this.tableData = [];
						this.total = 0;
					}
				});
			},
			// 切页
			handleCurrentChange(val) {
				this.currentPage = val;
				this.loadData();
			},
			handleDelete(index, row) {
				let that = this;
				layer.confirm('确认作废？<br><font color="red">注意：此操作不可逆！</font>', {
					icon: 3,
					title: '提示'
				}, function(index) {
					that.$http.post('iem/delStuPayment/' + row.bh, {
						_method: 'DELETE'
					}, function(d) {
						if(d.status == '1') {
							layer.close(index);
							that.loadData();
							layer.msg(d.msg);
						} else {
							layer.msg(d.msg, {
								shift: 6
							});
						}
					});
				});
			}
		}
	}
</script>

<style>

</style>